/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package day04;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class SingleArray {

    private int[] array = new int[5];

    public SingleArray() {
    }
    /*
     * nhap mang
     */

    public void input() {
        Scanner s = new Scanner(System.in);
        for (int i = 0; i < this.array.length; i++) {
            System.out.println("Nhap vao phan tu thu:" + i);
            this.array[i] = s.nextInt();
        }

    }
    /*
     * Xuat mang
     */

    public void xuatmang() {
        for (int i = 0; i < this.array.length; i++) {
            System.out.println("Array[ " + i + "] = " + this.array[i]);
        }

    }
    /*
     * Trung binh
     */

    public float trungBinh() {
        float sum = 0;
        for (int i = 0; i < this.array.length; i++) {
            sum += this.array[i];
        }
        return sum / this.array.length;
    }
    /*
     * Dem co bao nhieu so chan
     * 
     */

    public int demSoChan() {
        int count = 0;
        for (Integer a : this.array) {
            if (a % 2 == 0) {
                count++;
            }
        }
        return count;


    }
   
    /*
     * Dem so nguyen to
     */
    
    public int demSNT() {
        int count = 0;
        for (int i = 0; i < this.array.length; i++) {
            if (SNTUtils.ktSNT(this.array[i])) {
                count++;
            }
        }
        return count;
    }
    
}
